Optimal. Leaf size=153 \[ 4 a^3 (c-i d)^2 x-\frac {4 i a^3 (c-i d)^2 \log (\cos (e+f x))}{f}-\frac {2 a^3 (c-i d)^2 \tan (e+f x)}{f}+\frac {i a (c-i d)^2 (a+i a \tan (e+f x))^2}{2 f}+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.14, antiderivative size = 153, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {3624, 3608,
3559, 3558, 3556} \begin {gather*} -\frac {2 a^3 (c-i d)^2 \tan (e+f x)}{f}-\frac {4 i a^3 (c-i d)^2 \log (\cos (e+f x))}{f}+4 a^3 x (c-i d)^2+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}+\frac {i a (c-i d)^2 (a+i a \tan (e+f x))^2}{2 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3558
Rule 3559
Rule 3608
Rule 3624
Rubi steps
\begin {align*} \int (a+i a \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx &=-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}+\int (a+i a \tan (e+f x))^3 \left (c^2-d^2+2 c d \tan (e+f x)\right ) \, dx\\ &=\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}+(c-i d)^2 \int (a+i a \tan (e+f x))^3 \, dx\\ &=\frac {i a (c-i d)^2 (a+i a \tan (e+f x))^2}{2 f}+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}+\left (2 a (c-i d)^2\right ) \int (a+i a \tan (e+f x))^2 \, dx\\ &=4 a^3 (c-i d)^2 x-\frac {2 a^3 (c-i d)^2 \tan (e+f x)}{f}+\frac {i a (c-i d)^2 (a+i a \tan (e+f x))^2}{2 f}+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}+\left (4 i a^3 (c-i d)^2\right ) \int \tan (e+f x) \, dx\\ &=4 a^3 (c-i d)^2 x-\frac {4 i a^3 (c-i d)^2 \log (\cos (e+f x))}{f}-\frac {2 a^3 (c-i d)^2 \tan (e+f x)}{f}+\frac {i a (c-i d)^2 (a+i a \tan (e+f x))^2}{2 f}+\frac {2 c d (a+i a \tan (e+f x))^3}{3 f}-\frac {i d^2 (a+i a \tan (e+f x))^4}{4 a f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(948\) vs. \(2(153)=306\).
time = 7.27, size = 948, normalized size = 6.20 \begin {gather*} \frac {\cos ^3(e+f x) \left (c^2 \cos \left (\frac {3 e}{2}\right )-2 i c d \cos \left (\frac {3 e}{2}\right )-d^2 \cos \left (\frac {3 e}{2}\right )-i c^2 \sin \left (\frac {3 e}{2}\right )-2 c d \sin \left (\frac {3 e}{2}\right )+i d^2 \sin \left (\frac {3 e}{2}\right )\right ) \left (-2 i \cos \left (\frac {3 e}{2}\right ) \log \left (\cos ^2(e+f x)\right )-2 \log \left (\cos ^2(e+f x)\right ) \sin \left (\frac {3 e}{2}\right )\right ) (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {\cos (e+f x) \left (3 c^2 \cos (e)-18 i c d \cos (e)-15 d^2 \cos (e)+4 c d \sin (e)-6 i d^2 \sin (e)\right ) \left (-\frac {1}{6} i \cos (3 e)-\frac {1}{6} \sin (3 e)\right ) (a+i a \tan (e+f x))^3}{f \left (\cos \left (\frac {e}{2}\right )-\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {e}{2}\right )+\sin \left (\frac {e}{2}\right )\right ) (\cos (f x)+i \sin (f x))^3}+\frac {\sec (e+f x) \left (-\frac {1}{4} i d^2 \cos (3 e)-\frac {1}{4} d^2 \sin (3 e)\right ) (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {(c-i d)^2 \cos ^3(e+f x) (4 f x \cos (3 e)-4 i f x \sin (3 e)) (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {\left (\frac {1}{3} \cos (3 e)-\frac {1}{3} i \sin (3 e)\right ) \left (-2 i c d \sin (f x)-3 d^2 \sin (f x)\right ) (a+i a \tan (e+f x))^3}{f \left (\cos \left (\frac {e}{2}\right )-\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {e}{2}\right )+\sin \left (\frac {e}{2}\right )\right ) (\cos (f x)+i \sin (f x))^3}+\frac {\cos ^2(e+f x) \left (\frac {1}{3} \cos (3 e)-\frac {1}{3} i \sin (3 e)\right ) \left (-9 c^2 \sin (f x)+26 i c d \sin (f x)+15 d^2 \sin (f x)\right ) (a+i a \tan (e+f x))^3}{f \left (\cos \left (\frac {e}{2}\right )-\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {e}{2}\right )+\sin \left (\frac {e}{2}\right )\right ) (\cos (f x)+i \sin (f x))^3}+\frac {x \cos ^3(e+f x) \left (-2 c^2 \cos (e)+4 i c d \cos (e)+2 d^2 \cos (e)+2 c^2 \cos ^3(e)-4 i c d \cos ^3(e)-2 d^2 \cos ^3(e)+4 i c^2 \sin (e)+8 c d \sin (e)-4 i d^2 \sin (e)-8 i c^2 \cos ^2(e) \sin (e)-16 c d \cos ^2(e) \sin (e)+8 i d^2 \cos ^2(e) \sin (e)-12 c^2 \cos (e) \sin ^2(e)+24 i c d \cos (e) \sin ^2(e)+12 d^2 \cos (e) \sin ^2(e)+8 i c^2 \sin ^3(e)+16 c d \sin ^3(e)-8 i d^2 \sin ^3(e)+2 c^2 \sin (e) \tan (e)-4 i c d \sin (e) \tan (e)-2 d^2 \sin (e) \tan (e)+2 c^2 \sin ^3(e) \tan (e)-4 i c d \sin ^3(e) \tan (e)-2 d^2 \sin ^3(e) \tan (e)+i (c-i d)^2 (4 \cos (3 e)-4 i \sin (3 e)) \tan (e)\right ) (a+i a \tan (e+f x))^3}{(\cos (f x)+i \sin (f x))^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.13, size = 176, normalized size = 1.15
method | result | size |
derivativedivides | \(\frac {a^{3} \left (-\frac {i d^{2} \left (\tan ^{4}\left (f x +e \right )\right )}{4}-\frac {2 i c d \left (\tan ^{3}\left (f x +e \right )\right )}{3}-\frac {i c^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}+2 i d^{2} \left (\tan ^{2}\left (f x +e \right )\right )-d^{2} \left (\tan ^{3}\left (f x +e \right )\right )+8 i c d \tan \left (f x +e \right )-3 c d \left (\tan ^{2}\left (f x +e \right )\right )-3 c^{2} \tan \left (f x +e \right )+4 d^{2} \tan \left (f x +e \right )+\frac {\left (4 i c^{2}-4 i d^{2}+8 c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-8 i c d +4 c^{2}-4 d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) | \(176\) |
default | \(\frac {a^{3} \left (-\frac {i d^{2} \left (\tan ^{4}\left (f x +e \right )\right )}{4}-\frac {2 i c d \left (\tan ^{3}\left (f x +e \right )\right )}{3}-\frac {i c^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}+2 i d^{2} \left (\tan ^{2}\left (f x +e \right )\right )-d^{2} \left (\tan ^{3}\left (f x +e \right )\right )+8 i c d \tan \left (f x +e \right )-3 c d \left (\tan ^{2}\left (f x +e \right )\right )-3 c^{2} \tan \left (f x +e \right )+4 d^{2} \tan \left (f x +e \right )+\frac {\left (4 i c^{2}-4 i d^{2}+8 c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-8 i c d +4 c^{2}-4 d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) | \(176\) |
norman | \(\left (-8 i a^{3} c d +4 a^{3} c^{2}-4 a^{3} d^{2}\right ) x -\frac {\left (2 i a^{3} c d +3 a^{3} d^{2}\right ) \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}-\frac {\left (-8 i a^{3} c d +3 a^{3} c^{2}-4 a^{3} d^{2}\right ) \tan \left (f x +e \right )}{f}-\frac {i a^{3} d^{2} \left (\tan ^{4}\left (f x +e \right )\right )}{4 f}+\frac {i a^{3} \left (6 i c d -c^{2}+4 d^{2}\right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {2 i a^{3} \left (-2 i c d +c^{2}-d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f}\) | \(182\) |
risch | \(\frac {16 i a^{3} c d e}{f}-\frac {8 a^{3} c^{2} e}{f}+\frac {8 a^{3} d^{2} e}{f}-\frac {2 i a^{3} \left (12 c^{2} {\mathrm e}^{6 i \left (f x +e \right )}-36 d^{2} {\mathrm e}^{6 i \left (f x +e \right )}-48 i c d \,{\mathrm e}^{6 i \left (f x +e \right )}+33 c^{2} {\mathrm e}^{4 i \left (f x +e \right )}-69 d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-114 i c d \,{\mathrm e}^{4 i \left (f x +e \right )}+30 c^{2} {\mathrm e}^{2 i \left (f x +e \right )}-54 d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-92 i c d \,{\mathrm e}^{2 i \left (f x +e \right )}+9 c^{2}-15 d^{2}-26 i c d \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}-\frac {8 a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c d}{f}-\frac {4 i a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c^{2}}{f}+\frac {4 i a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) d^{2}}{f}\) | \(272\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 187, normalized size = 1.22 \begin {gather*} -\frac {3 i \, a^{3} d^{2} \tan \left (f x + e\right )^{4} + 4 \, {\left (2 i \, a^{3} c d + 3 \, a^{3} d^{2}\right )} \tan \left (f x + e\right )^{3} + 6 \, {\left (i \, a^{3} c^{2} + 6 \, a^{3} c d - 4 i \, a^{3} d^{2}\right )} \tan \left (f x + e\right )^{2} - 48 \, {\left (a^{3} c^{2} - 2 i \, a^{3} c d - a^{3} d^{2}\right )} {\left (f x + e\right )} + 24 \, {\left (-i \, a^{3} c^{2} - 2 \, a^{3} c d + i \, a^{3} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 12 \, {\left (3 \, a^{3} c^{2} - 8 i \, a^{3} c d - 4 \, a^{3} d^{2}\right )} \tan \left (f x + e\right )}{12 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 371 vs. \(2 (132) = 264\).
time = 1.12, size = 371, normalized size = 2.42 \begin {gather*} -\frac {2 \, {\left (9 i \, a^{3} c^{2} + 26 \, a^{3} c d - 15 i \, a^{3} d^{2} + 12 \, {\left (i \, a^{3} c^{2} + 4 \, a^{3} c d - 3 i \, a^{3} d^{2}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, {\left (11 i \, a^{3} c^{2} + 38 \, a^{3} c d - 23 i \, a^{3} d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, {\left (15 i \, a^{3} c^{2} + 46 \, a^{3} c d - 27 i \, a^{3} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + 6 \, {\left (i \, a^{3} c^{2} + 2 \, a^{3} c d - i \, a^{3} d^{2} + {\left (i \, a^{3} c^{2} + 2 \, a^{3} c d - i \, a^{3} d^{2}\right )} e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, {\left (i \, a^{3} c^{2} + 2 \, a^{3} c d - i \, a^{3} d^{2}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, {\left (i \, a^{3} c^{2} + 2 \, a^{3} c d - i \, a^{3} d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, {\left (i \, a^{3} c^{2} + 2 \, a^{3} c d - i \, a^{3} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )\right )}}{3 \, {\left (f e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, f e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 313 vs. \(2 (129) = 258\).
time = 0.61, size = 313, normalized size = 2.05 \begin {gather*} - \frac {4 i a^{3} \left (c - i d\right )^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac {- 18 i a^{3} c^{2} - 52 a^{3} c d + 30 i a^{3} d^{2} + \left (- 60 i a^{3} c^{2} e^{2 i e} - 184 a^{3} c d e^{2 i e} + 108 i a^{3} d^{2} e^{2 i e}\right ) e^{2 i f x} + \left (- 66 i a^{3} c^{2} e^{4 i e} - 228 a^{3} c d e^{4 i e} + 138 i a^{3} d^{2} e^{4 i e}\right ) e^{4 i f x} + \left (- 24 i a^{3} c^{2} e^{6 i e} - 96 a^{3} c d e^{6 i e} + 72 i a^{3} d^{2} e^{6 i e}\right ) e^{6 i f x}}{3 f e^{8 i e} e^{8 i f x} + 12 f e^{6 i e} e^{6 i f x} + 18 f e^{4 i e} e^{4 i f x} + 12 f e^{2 i e} e^{2 i f x} + 3 f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 670 vs. \(2 (132) = 264\).
time = 0.76, size = 670, normalized size = 4.38 \begin {gather*} -\frac {2 \, {\left (6 i \, a^{3} c^{2} e^{\left (8 i \, f x + 8 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 12 \, a^{3} c d e^{\left (8 i \, f x + 8 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 6 i \, a^{3} d^{2} e^{\left (8 i \, f x + 8 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 24 i \, a^{3} c^{2} e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 48 \, a^{3} c d e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 24 i \, a^{3} d^{2} e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 36 i \, a^{3} c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 72 \, a^{3} c d e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 36 i \, a^{3} d^{2} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 24 i \, a^{3} c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 48 \, a^{3} c d e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 24 i \, a^{3} d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 12 i \, a^{3} c^{2} e^{\left (6 i \, f x + 6 i \, e\right )} + 48 \, a^{3} c d e^{\left (6 i \, f x + 6 i \, e\right )} - 36 i \, a^{3} d^{2} e^{\left (6 i \, f x + 6 i \, e\right )} + 33 i \, a^{3} c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + 114 \, a^{3} c d e^{\left (4 i \, f x + 4 i \, e\right )} - 69 i \, a^{3} d^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + 30 i \, a^{3} c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 92 \, a^{3} c d e^{\left (2 i \, f x + 2 i \, e\right )} - 54 i \, a^{3} d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 6 i \, a^{3} c^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 12 \, a^{3} c d \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 6 i \, a^{3} d^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 9 i \, a^{3} c^{2} + 26 \, a^{3} c d - 15 i \, a^{3} d^{2}\right )}}{3 \, {\left (f e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, f e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.92, size = 217, normalized size = 1.42 \begin {gather*} \frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {a^3\,d^2\,1{}\mathrm {i}}{2}-\frac {a^3\,\left (c^2\,1{}\mathrm {i}+4\,c\,d-d^2\,1{}\mathrm {i}\right )}{2}+a^3\,d\,\left (d+c\,1{}\mathrm {i}\right )\,1{}\mathrm {i}\right )}{f}-\frac {{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (\frac {a^3\,d^2}{3}+\frac {2\,a^3\,d\,\left (d+c\,1{}\mathrm {i}\right )}{3}\right )}{f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (a^3\,c^2\,4{}\mathrm {i}+8\,a^3\,c\,d-a^3\,d^2\,4{}\mathrm {i}\right )}{f}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^3\,d^2+a^3\,\left (c^2\,1{}\mathrm {i}+4\,c\,d-d^2\,1{}\mathrm {i}\right )\,1{}\mathrm {i}-2\,a^3\,c\,\left (c-d\,1{}\mathrm {i}\right )+2\,a^3\,d\,\left (d+c\,1{}\mathrm {i}\right )\right )}{f}-\frac {a^3\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^4\,1{}\mathrm {i}}{4\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________